﻿package code.admin 
{
	import flash.display.*;
	import flash.events.*
	import gemini.utils.*
	import caurina.transitions.*
	public class Palette extends Sprite
	{
		var mainframe;
		var mods;
		var n = 0;
		var head;
		public function Palette(mf)
		{
			mainframe = mf;
			head=new palettehead();
			head.cacheAsBitmap=true;
			addChild(head);
			mods=new Sprite();
			mods.x = 0;
			mods.y = head.height;
			addChild(mods);
			
			//setSensorArea(head.btn);
			head.btn.addEventListener(MouseEvent.MOUSE_DOWN,dragMe);
			head.btn.addEventListener(MouseEvent.MOUSE_UP,dontdragMe);
			Filters.addFilters(this,"DropShadowFilter,quality:3,strength:.5,distance:1");
		}
		public function addModule(m)
		{
			trace("adding module "+m);
			m.onselect=selected
			mods.addChild(m);
			m.y=m.height*n
			n++;
			trace("---- > "+n);

		}
		public function selected(e)
		{
			trace("module "+e+" selected");
			for(var n=0;n<mods.numChildren;n++)
			{
				var obj=mods.getChildAt(n)
				trace(obj,e);
				if(obj!=e)
				{
					obj.hideAll();
				}
				
			}
		}
		public function delesected(e)
		{
			
		}
		private function dragMe(e)
		{
			this.startDrag();
		}
		private function dontdragMe(e)
		{
			this.stopDrag();
		}

	}

}